package com.credit.management.system.generator.dao;

import com.credit.management.system.model.Project;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface ProjectMapper {
    @Delete({
        "delete from project",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into project (id, cid, ",
        "projectname, projectnum, ",
        "projectdetial, state, ",
        "projectmoney)",
        "values (#{id,jdbcType=INTEGER}, #{cid,jdbcType=INTEGER}, ",
        "#{projectname,jdbcType=VARCHAR}, #{projectnum,jdbcType=VARCHAR}, ",
        "#{projectdetial,jdbcType=VARCHAR}, #{state,jdbcType=VARCHAR}, ",
        "#{projectmoney,jdbcType=VARCHAR})"
    })
    int insert(Project record);

    int insertSelective(Project record);

    @Select({
        "select",
        "id, cid, projectname, projectnum, projectdetial, state, projectmoney",
        "from project",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("com.credit.management.system.generator.dao.ProjectMapper.BaseResultMap")
    Project selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Project record);

    @Update({
        "update project",
        "set cid = #{cid,jdbcType=INTEGER},",
          "projectname = #{projectname,jdbcType=VARCHAR},",
          "projectnum = #{projectnum,jdbcType=VARCHAR},",
          "projectdetial = #{projectdetial,jdbcType=VARCHAR},",
          "state = #{state,jdbcType=VARCHAR},",
          "projectmoney = #{projectmoney,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Project record);
}